<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	// 当一个嵌套的内部(子)函数引用了嵌套的外部(父)函数的变量(函数)时, 就产生了闭包.
	function fn(){
		let i=0;
		return function(){
			i+=1;
			console.log(i);
		}
	}
	// fn()()
	const run = fn();
	run();
	run();
	run();
	run();
	run();
	run();
</script>
</html>